<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" > 

<html>
<head>
<base href="<%=basePath%>">
<title>疾病详情</title>
<link rel="stylesheet" href="./js/bootstrap-3.3.5-dist/css/bootstrap.css" type="text/css"/>
<link rel="stylesheet" href="./js/metisMenu/metisMenu.min.css">
<link rel="stylesheet" href="./css/sb-admin/sb-admin-2.css">
<link rel="stylesheet" href="./css/base.css">
<link rel="stylesheet" href="./css/illness.css">
<link rel="stylesheet" href="./js/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="./js/bootstrap-table/bootstrap-table.min.css">
<link rel="stylesheet" href="./js/bootstrap-multiselect/bootstrap-multiselect.css" type="text/css"/>
<link rel="stylesheet" href="./js/bootstrap-3.3.5-dist/css/bootstrap-datetimepicker.css">

<script type="text/javascript" src="./js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="./js/bootstrap-3.3.5-dist/js/bootstrap.js"></script>
<script type="text/javascript" src="./js/metisMenu/metisMenu.js"></script>
<script type="text/javascript" src="./js/common.js"></script>
<script src="./js/bootstrap-table/bootstrap-table-all.min.js"></script>
<script src="./js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script src="./js/bootstrap-multiselect/bootstrap-multiselect.js"></script>
<script src="./js/bootstrap-jquery-plugin/jquery.bootstrap.js"></script>
<script src="./js/bootstrap-3.3.5-dist/js/bootstrap-datetimepicker.js"></script>
<script src="./js/bootstrap-3.3.5-dist/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="./js/ajaxfileupload.js"></script>

</head>
<body>
	<jsp:include page="../template/head.jsp" />
	<jsp:include page="../template/leftnav.jsp" />
	<div id="page-wrapper">
		<div class="wrapper">
			<h1><a href="./jsp/illness/illness.jsp">疾病列表</a></h1><h3> <span> > </span> 疾病详情</h3>
		</div>
		<div class="bHead">
			<ul class="list-inline">	
				<li style="width: 60%;">
					<label>疾病名称：</label>
					<input class="form-control" style="display:-webkit-inline-box;width: inherit;" id="illName";/>
					<span class="btn detail—btn" onclick="editill()" id="editill">修改</span>
					<span class="btn detail—btn" onclick="confirmill()" id="confirmill">确认</span>
					<span class="btn detail—btn" onclick="cancelill()" id="cancelill">取消</span>
				</li>
			</ul>
		</div>	
		<div class="i-detail i-detail-info">
			<h3>基本信息</h3>
				<div class="list-inline" style="margin:5px">
				<label>多发性别：</label>
				<input class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="specialCrowd"/>
				<div class="list-inline" style="display: none;margin:1px" id="sCrowdSel">
					<select id="specialCrowdSel">
					    <option value="0" selected>男</option>
					    <option value="1" selected>女</option>
					    <option value="2" selected>全部</option>
					</select>
				</div>
			</div>
			<div class="list-inline" style="margin:5px">
				<label>疾病年龄：</label>
				<input class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="age"/>
				<div class="list-inline" style="display: none;" id="ageSel">
		        	<select id="ssdiseaseAgeSel" multiple="multiple">
					    <option value="1" selected>0-30天</option>
					    <option value="2" selected>31天-3岁</option>
					    <option value="3" selected>4-8岁</option>
					    <option value="4" selected>9-14岁</option>
					    <option value="5" selected>15-35岁</option>
					    <option value="6" selected>36-64岁</option>
					    <option value="7" selected>65岁以上</option>
					</select>
				</div>
			</div>
			<div class="list-inline" style="margin:5px">
				<label>一级科目：</label>
				<input class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="levelOneSubject"/>
			</div>
			<div class="list-inline" style="margin:5px">
				<label>二级科目：</label>
				<input class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="levelTwoSubject"/>
			</div>
<!-- 			<div class="list-inline" style="margin:5px;">
				<label>是否受伤：</label>
				<input class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="isInjured"/>
				<div class="list-inline" style="display: none;">
					<select id="isInjuredSel">
					    <option value="1" selected>是</option>
					    <option value="0" selected>否</option>
					</select>
				</div>
			</div> -->
			<div class="list-inline" style="margin:5px">
				<label>疾病等级：</label>
				<input class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="ill_warning"/>
			</div>
			<div class="list-inline" style="margin:5px">
				<label>限制个数：</label>
				<input class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="limitNum"/>
			</div>
			<div class="list-inline" style="margin:5px">
				<label >发生时间：</label>
				<textarea class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="duration" ></textarea>
			</div>
			<div class="list-inline" style="margin:5px">
				<label>辅助检查：</label>
				<textarea class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="examNames" ></textarea>
			</div>
			<div class="list-inline" style="margin:5px">
				<label>病情病因：</label>
				<textarea class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="pathogen" ></textarea>
			</div>
			<div class="list-inline" style="margin:5px">
				<label>诊疗方案：</label>
				<textarea class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="scheme" ></textarea>
			</div>
			<div class="list-inline" style="margin:5px">
				<label>疾病用药：</label>
				<textarea class="form-control" style="width:85% !important; display:-webkit-inline-box;width: inherit;" id="medicines" ></textarea>
			</div>

		</div>
		
		<div class="panel bs-panel-primary" style="height: auto !important" >
			<div class="panel-heading">症状名称:
<!-- 				<span class="btn detail—btn" onclick="addSymptomDiv()">添加</span> -->
			</div>
			<div class="list-inline" >
				<div style="margin:5px 5px 5px 15px;">
					<!-- <label>其它病症：</label> -->
				</div>
				<div id="ii"></div>
			</div>
		</div>
		
<!-- 		<div class="panel bs-panel-primary" style="height: auto !important" >
			<div class="panel-heading">部位名称:
				<span class="btn detail—btn" onclick="addpartsDiv()">添加</span>
			</div>
			<div class="list-inline" >
				<div id="pp"></div>
			</div>
		</div> -->
		
<!-- 		<div style="text-align: center;padding: 40px 0;">
			<button onclick="addIll()" class="btn btn-primary">提交</button>
			<a href="./jsp/illness/illness.jsp" class="btn btn-primary">取消</a>
		</div> -->
		
		
		
		<div id="eidtwrap" style="display:none">
		  <form id="editform" role="form" class="form-horizontal">
			<img alt="" src="" id="imgurls">
		</div>
		
</body>
<script type="text/javascript">

	function editill(){
         $("#levelOneSubject").removeAttr("readonly");
         $("#levelTwoSubject").removeAttr("readonly");
         $("#ill_warning").removeAttr("readonly");
         $("#limitNum").removeAttr("readonly");
         $("#duration").removeAttr("readonly");
         $("#examNames").removeAttr("readonly");
         $("#scheme").removeAttr("readonly");
         $("#pathogen").removeAttr("readonly");
         $("#medicines").removeAttr("readonly");
         $("#editill").hide();
         $("#confirmill").show();
         $("#cancelill").show();
         $("#specialCrowd").hide();
         $("#sCrowdSel").show();
         document.getElementById("sCrowdSel").style.display='inline-block';
         
         
	}
	
	function confirmill(){
		var illName = $("#illName").val();
		var levelOneSubject = $("#levelOneSubject").val();
		var levelTwoSubject = $("#levelTwoSubject").val();
    	var duration = $("#duration").val();
   		var examNames = $("#examNames").val();
   		var sex = $("#specialCrowdSel").val();
   		var pathogen = $("#pathogen").val();
   		var scheme = $("#scheme").val();
   		var medicines = $("#medicines").val();
       	var obj = {
        	illness:illName,
			duration:duration,
			sex:sex,
			levelOneSubject:levelOneSubject,
			levelTwoSubject:levelTwoSubject,
			assistantExam:examNames,
			pathogen:pathogen,
			scheme:scheme,
			medicine:medicines,
        };
		$.messager.model = { 
			//定义消息提示框
		   	ok:{ text: "确定", classed: 'btn btn-success' },
		    cancel:{text:"取消",classed: 'btn btn-error' }
		};
		$.messager.confirm("温馨提示", "确定更改疾病?", function(){
			$.ajax({
				url: "./adminIllness/editIllness",
				data:obj,
				type: "POST",
				dataType: 'json',
				cache: false,
				success: function(ret) {
					$.messager.popup("修改成功");
					if(ret.resultCode==0){
						 location.reload();
					}
				}
			});
		});
	}
	
	function cancelill(){
		 $("#levelOneSubject").attr({readonly:'true'});
         $("#levelTwoSubject").attr({readonly:'true'});
         $("#ill_warning").attr({readonly:'true'});
         $("#limitNum").attr({readonly:'true'});
         $("#duration").attr({readonly:'true'});
         $("#examNames").attr({readonly:'true'});
         $("#scheme").attr({readonly:'true'});
         $("#pathogen").attr({readonly:'true'});
         $("#medicines").attr({readonly:'true'});
         $("#editill").show();
         $("#confirmill").hide();
         $("#cancelill").hide();
         $("#sCrowdSel").hide();
         $("#specialCrowd").show();
	}

	function showimg(url){
	   	$("#eidtwrap").show();
	   	$("#imgurls").attr("src", "../img/"+url); 
		$("#eidtwrap").dialog({
	         	title   : "图片预览",
	        	'class' :  "mydialog",
	        	onClose : function() { 
	         		 $(this).dialog("close");
	          	}, 
	          	buttons : [{
	             text : "关闭",
	             'class' : "btn btn-default",
	             click : function() {
	                	 $(this).dialog("close");
	             	}
	         }]
	     });
	}
	
	
	function editsym(id){

   		$("#symptom"+id+"").removeAttr("readonly");
   		$("#degree"+id+"").removeAttr("readonly");
   		$("#nature"+id+"").removeAttr("readonly");
   		$("#times"+id+"").removeAttr("readonly");
   		$("#medicine"+id+"").removeAttr("readonly");
 		$("#parts"+id+"").removeAttr("readonly");
 		$("#description"+id+"").removeAttr("readonly");
 		
 		$("#pastHistory"+id+"").removeAttr("readonly"); 
 		$("#incentive"+id+"").removeAttr("readonly"); 
 		$("#medicineHistory"+id+"").removeAttr("readonly"); 
 		$("#factor"+id+"").removeAttr("readonly");
 		
 		$("#isImportant"+id+"").removeAttr("readonly"); 
 		$("#historySort"+id+"").removeAttr("readonly"); 
 		$("#warning"+id+"").removeAttr("readonly"); 
 		$("#limitSymptoms"+id+"").removeAttr("readonly"); 
 		$("#sex"+id+"").removeAttr("readonly");  		 		
   		
   		$("#sdown"+id+"").removeAttr("readonly");
   		$("#sup"+id+"").removeAttr("readonly");
		$("#imgurl"+id+"").show(); 
		$("#imgurlBT"+id+"").hide();  
		$("#imgurltext"+id+"").show();
		$("#imgurl"+id+"").removeAttr("readonly");
		
		$("#confirmsym"+id+"").show();
        $("#cancelsym"+id+"").show();
        $("#editsym"+id+"").hide();
        $("#file"+id+"").show();
        $("#upload"+id+"").show();
		
	}
	
	function cancelsym(id){

   		$("#symptom"+id+"").attr({readonly:'true'});
   		$("#degree"+id+"").attr({readonly:'true'});
   		$("#nature"+id+"").attr({readonly:'true'});
   		$("#times"+id+"").attr({readonly:'true'});
   		$("#medicine"+id+"").attr({readonly:'true'});
 		$("#parts"+id+"").attr({readonly:'true'});
 		$("#description"+id+"").attr({readonly:'true'});
 		
 		$("#pastHistory"+id+"").attr({readonly:'true'});
 		$("#incentive"+id+"").attr({readonly:'true'});
 		$("#medicineHistory"+id+"").attr({readonly:'true'});
 		$("#factor"+id+"").attr({readonly:'true'});
 		
 		$("#isImportant"+id+"").attr({readonly:'true'});
 		$("#historySort"+id+"").attr({readonly:'true'});
 		$("#warning"+id+"").attr({readonly:'true'});
 		$("#limitSymptoms"+id+"").attr({readonly:'true'});
 		$("#sex"+id+"").attr({readonly:'true'});
   		
   		$("#sdown"+id+"").attr({readonly:'true'});
   		$("#sup"+id+"").attr({readonly:'true'});
		$("#imgurl"+id+"").show(); 
		$("#imgurlBT"+id+"").hide();  
		$("#imgurltext"+id+"").show();
		$("#imgurl"+id+"").attr({readonly:'true'});
		
		$("#confirmsym"+id+"").hide();
        $("#cancelsym"+id+"").hide();
        $("#editsym"+id+"").show();
        $("#file"+id+"").hide();
        $("#upload"+id+"").hide();
        
        var imgu = $("#imgurl"+id+"").val();
        if(imgu=='' || imgu==null){
       		$("#imgurl"+id+"").hide(); 
			$("#imgurlBT"+id+"").hide();  
			$("#imgurltext"+id+"").hide();
        }
		
	}
	
	function confirmsym(id){
   		var symptom = $("#symptom"+id+"").val();
   		var parts = $("#parts"+id+"").val();
   		var degree = $("#degree"+id+"").val();
   		var nature = $("#nature"+id+"").val();
   		var times = $("#times"+id+"").val();
   		var medicine = $("#medicine"+id+"").val();
   		var sdown = $("#sdown"+id+"").val();
   		var sup = $("#sup"+id+"").val();
		var imgurl = $("#imgurl"+id+"").val();
		var description = $("#description"+id+"").val();
		
		var obj = {
			illness : illName,
			symptom :symptom,
			degree : degree,
			nature : nature,
			times : times,
			medicine :medicine,
			sdown : sdown,
			sup :sup,
			imgurl :imgurl,
			id : id,
			parts :parts,
			description : description
		};
		
		$.messager.model = { 
			//定义消息提示框
		   	ok:{ text: "确定", classed: 'btn btn-success' },
		    cancel:{text:"取消",classed: 'btn btn-error' }
		};
		$.messager.confirm("温馨提示", "确定更改症状?", function(){
			$.ajax({
				url: "./adminIllness/editSym",
				data:obj,
				type: "POST",
				dataType: 'json',
				cache: false,
				success: function(ret) {
					$.messager.popup("修改成功");
					if(ret.resultCode==0){
						location.reload();
					}
				}
			});
		});
	}
	
	
	function ajaxFileUpload(id){
	    $.ajaxFileUpload({
	            url: "./imageOpt/photoUpload",
	            secureuri: false, 
	            fileElementId: 'file'+id, 
	            dataType: 'json', 
	            success: function (data, status){
	            	if(data.resultCode==0){
	            		$("#imgurl"+id+"").val(data.content);
	            	}
					$.messager.popup(data.msg);
	            },
	            error: function (data, status, e){
	                alert(e);
	            }
	        }
	    )
	    return false;
	}

	function confirmpart(id){
		$.messager.model = { 
			//定义消息提示框
		   	ok:{ text: "确定", classed: 'btn btn-success' },
		    cancel:{text:"取消",classed: 'btn btn-error' }
		};
		$.messager.confirm("温馨提示", "确定更改部位?", function(){
			$.ajax({
				url: "./adminIllness/editPart",
				data:{
					illness : illName,
					part: $("#p"+id+"").val(),
					id : id
				},
				type: "POST",
				dataType: 'json',
				cache: false,
				success: function(ret) {
					$.messager.popup("修改成功");
					if(ret.resultCode==0){
						location.reload();
					}
				}
			});
		});
	}
	
	function editpart(id){
        $("#p"+id+"").removeAttr("readonly");
        $("#confirmpart"+id+"").show();
        $("#cancelpart"+id+"").show();
        $("#editpart"+id+"").hide();
	}
	
	function cancelpart(id){
        $("#p"+id+"").attr({readonly:'true'});
        $("#confirmpart"+id+"").hide();
        $("#cancelpart"+id+"").hide();
        $("#editpart"+id+"").show();
	}

	function showPartsDiv(data){
		var html = '<div style="margin:5px 5px 5px 15px;">'+
			'<span style="color: #37bd9c;" class="glyphicon glyphicon-plus icon-plus" aria-hidden="true" ></span>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;margin:3px;" id="p'+data.id+'" '+'/>'+
			'<span class="btn detail—btn" onclick="editpart(\''+data.id+'\')" style="margin-left:3px;" id="editpart'+data.id+'">修改</span>'+
			'<span class="btn detail—btn" onclick="confirmpart(\''+data.id+'\')" style="margin-left:3px;" id="confirmpart'+data.id+'">确认</span>'+
			'<span class="btn detail—btn" onclick="cancelpart(\''+data.id+'\')" style="margin-left:3px;" id="cancelpart'+data.id+'">取消</span>'+
			'</div>';
		var div =document.createElement("div");
        div.innerHTML=html;
   		document.getElementById("pp").appendChild(div);
	}
	
	function showSymptomDiv(data){
		var html = '<div style="margin:5px 5px 5px 15px;">'+
			'<span style="color: #37bd9c;" class="glyphicon glyphicon-plus icon-plus" aria-hidden="true" ></span>'+
			'<lable style="margin-left: 5px;">症状：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;" id="symptom'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">部位：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;" id="parts'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">程度：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="degree'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">性质：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="nature'+data.id+'" '+'/>'+
			'<span class="btn detail—btn" onclick="editsym(\''+data.id+'\')" style="margin-left:3px;" id="editsym'+data.id+'">修改</span>'+
			'<span class="btn detail—btn" onclick="confirmsym(\''+data.id+'\')" style="margin-left:3px;" id="confirmsym'+data.id+'">确认</span>'+
			'<span class="btn detail—btn" onclick="cancelsym(\''+data.id+'\')" style="margin-left:3px;" id="cancelsym'+data.id+'">取消</span>'+
			
			'<br>'+
			'<span style="color: #37bd9c;opacity:0;" class="glyphicon glyphicon-plus icon-plus" aria-hidden="true" ></span>'+
			'<lable style="margin-left: 5px;">既往史：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="pastHistory'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">诱因：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="incentive'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">药物服用史：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="medicineHistory'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">症状因素：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="factor'+data.id+'" '+'/>'+
			
			'<br>'+
			'<span style="color: #37bd9c;opacity:0;" class="glyphicon glyphicon-plus icon-plus" aria-hidden="true" ></span>'+
			'<lable style="margin-left: 5px;">是否重要：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="isImportant'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">症状分类：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="historySort'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">症状等级：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="warning'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">是否限制：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="limitSymptoms'+data.id+'" '+'/>'+
			
			'<br>'+
			'<span style="color: #37bd9c;opacity:0;" class="glyphicon glyphicon-plus icon-plus" aria-hidden="true" ></span>'+
			'<lable style="margin-left: 5px;">性别：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="sex'+data.id+'" '+'/>'+
			
			'<lable style="margin-left: 5px;">次数：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="times'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">用药：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="medicine'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">值下限：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="sdown'+data.id+'" '+'/>'+
			'<lable style="margin-left: 5px;">值上行：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit;width: 13%;margin:3px;" id="sup'+data.id+'" '+'/>'+
			'<br>'+
			'<span style="color: #37bd9c;opacity:0;" class="glyphicon glyphicon-plus icon-plus" aria-hidden="true" ></span>'+
			'<lable style="margin-left: 5px;">描述：</lable>'+
			'<textarea class="form-control" style="display:-webkit-inline-box;width: inherit;" id="description'+data.id+'" ></textarea>'+
			'<lable style="margin-left: 5px;" id="imgurltext'+data.id+'">图片：</lable>'+
			'<input class="form-control" style="display:-webkit-inline-box;width: inherit; width: 13%;"  id="imgurl'+data.id+'" />'+
			'<input type="file" id="file'+data.id+'" name="file" style="width:30%;display:inline-block;margin-left:5px"/><input id="upload'+data.id+'" type="button" value="上传照片" onclick="ajaxFileUpload('+data.id+')"/>'+
			'<span class="btn detail—btn" onclick="showimg(\''+data.imgurl+'\')" style="margin-left:3px;" id="imgurlBT'+data.id+'">预览</span>'+
			'</div>';
		var div =document.createElement("div");
        div.innerHTML=html;
   		document.getElementById("ii").appendChild(div);
	}
	
	var illName = $.getUrlParam("illName");
	$("#illName").val(illName);
	$("#illName").attr({readonly:'true'});
	
	$(function (){
	
         $("#confirmill").hide();
         $("#cancelill").hide();
	
/* 	 	$('#isInjuredSel').multiselect({
		 	includeSelectAllOption: true,
		 	buttonWidth: '150px'
		 }); */
		 
	 	 $('#ssdiseaseAgeSel').multiselect({
		 	includeSelectAllOption: true,
		 	selectAllText: "全部年龄",
		 	allSelectedText:"全选",
		 	nonSelectedText:"无",
		 	buttonWidth: '150px'
		 });
		 
	 	 $('#specialCrowdSel').multiselect({
		 	includeSelectAllOption: true,
		 	buttonWidth: '150px'
		 });
	
		$.ajax({
           url: "./adminIllness/getIllnessDetail",
           data: {
               illness: $.getUrlParam("illName")
           },
           type: "GET",
           dataType: 'json',
           cache: false,
           success: function (ret) {
           	  
              $("#levelOneSubject").val(ret.levelOneSubject);
              $("#levelOneSubject").attr({readonly:'true'});
              $("#levelTwoSubject").val(ret.levelTwoSubject);
              $("#levelTwoSubject").attr({readonly:'true'});
              
              $("#ill_warning").val(ret.warning);
              $("#ill_warning").attr({readonly:'true'});
              $("#limitNum").val(ret.limitNum);
              $("#limitNum").attr({readonly:'true'});
              
              $("#duration").val(ret.duration);
              $("#duration").attr({readonly:'true'});
              $("#examNames").val(ret.assistantExam);
              $("#examNames").attr({readonly:'true'});
              $("#scheme").val(ret.scheme);
              $("#scheme").attr({readonly:'true'});
              $("#pathogen").val(ret.pathogen);
              $("#pathogen").attr({readonly:'true'});
              $("#medicines").val(ret.medicine);
              $("#medicines").attr({readonly:'true'});
/* 			  if(ret.isInjured==1){
			  	$("#isInjured").val("是");
			  }else{
			  	$("#isInjured").val("否");
			  }
              $("#isInjured").attr({readonly:'true'}); */
              
              if(ret.sex==0){
              	$("#specialCrowd").val("男");
              }else if(ret.sex==1){
              	$("#specialCrowd").val("女");
              }else{
              	$("#specialCrowd").val("全部");
              }
              $("#specialCrowd").attr({readonly:'true'});
              
              if(ret.diseaseStartTime==0 && ret.diseaseEndTime==200){
              	$("#age").val("全年龄段");
              }else{
              	$("#age").val(ret.diseaseStartTime+"~"+ret.diseaseEndTime+"岁");
              }
              $("#age").val(ageFormatter(ret));
              $("#age").attr({readonly:'true'});
              
/*               for(var i=0;i<ret.partss.length;i++){
              	showPartsDiv(ret.partss[i]);
              	$("#p"+ret.partss[i].id+"").val(ret.partss[i].part);
              	$("#p"+ret.partss[i].id+"").attr({readonly:'true'});
              	$("#confirmpart"+ret.partss[i].id+"").hide();
              	$("#cancelpart"+ret.partss[i].id+"").hide();
              } */
              
              for(var i=0;i<ret.symptoms.length;i++){

              		showSymptomDiv(ret.symptoms[i]);
              		$("#symptom"+ret.symptoms[i].id+"").val(ret.symptoms[i].symptom);
              		$("#degree"+ret.symptoms[i].id+"").val(ret.symptoms[i].degree);
              		$("#nature"+ret.symptoms[i].id+"").val(ret.symptoms[i].nature);
              		$("#times"+ret.symptoms[i].id+"").val(ret.symptoms[i].times);
              		$("#medicine"+ret.symptoms[i].id+"").val(ret.symptoms[i].medicine);
              		$("#parts"+ret.symptoms[i].id+"").val(ret.symptoms[i].parts);
              		$("#description"+ret.symptoms[i].id+"").val(ret.symptoms[i].description);
              		$("#pastHistory"+ret.symptoms[i].id+"").val(ret.symptoms[i].pastHistory);
              		$("#incentive"+ret.symptoms[i].id+"").val(ret.symptoms[i].incentive);
              		$("#medicineHistory"+ret.symptoms[i].id+"").val(ret.symptoms[i].medicineHistory);
              		$("#factor"+ret.symptoms[i].id+"").val(ret.symptoms[i].factor);
              		
              		$("#isImportant"+ret.symptoms[i].id+"").val(ret.symptoms[i].isImportant);
              		$("#historySort"+ret.symptoms[i].id+"").val(ret.symptoms[i].historySort);
              		$("#warning"+ret.symptoms[i].id+"").val(ret.symptoms[i].warning);
              		$("#limitSymptoms"+ret.symptoms[i].id+"").val(ret.symptoms[i].limitSymptoms);
              		$("#sex"+ret.symptoms[i].id+"").val(ret.symptoms[i].sex);              		
              		
            		$("#symptom"+ret.symptoms[i].id+"").attr({readonly:'true'});
			   		$("#degree"+ret.symptoms[i].id+"").attr({readonly:'true'});
			   		$("#nature"+ret.symptoms[i].id+"").attr({readonly:'true'});
			   		$("#times"+ret.symptoms[i].id+"").attr({readonly:'true'});
			   		$("#medicine"+ret.symptoms[i].id+"").attr({readonly:'true'});
			   		$("#parts"+ret.symptoms[i].id+"").attr({readonly:'true'});
			   		$("#description"+ret.symptoms[i].id+"").attr({readonly:'true'});
			   		$("#pastHistory"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		$("#incentive"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		$("#medicineHistory"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		$("#factor"+ret.symptoms[i].id+"").attr({readonly:'true'});    

              		$("#isImportant"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		$("#historySort"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		$("#warning"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		$("#limitSymptoms"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		$("#sex"+ret.symptoms[i].id+"").attr({readonly:'true'}); 
			   		
              		if(ret.symptoms[i].type==1){
              			$("#type"+ret.symptoms[i].id+"").val("是");
              		}else{
              			$("#type"+ret.symptoms[i].id+"").val("否");
              		}
              		$("#type"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		
              		
              		$("#sdown"+ret.symptoms[i].id+"").val(ret.symptoms[i].sdown);
              		$("#sup"+ret.symptoms[i].id+"").val(ret.symptoms[i].sup);
              		$("#sdown"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		$("#sup"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		
              		var imgu = ret.symptoms[i].imgurl;
              		if(imgu=='' || imgu==null){
              			$("#imgurl"+ret.symptoms[i].id+"").hide(); 
						$("#imgurlBT"+ret.symptoms[i].id+"").hide();  
						$("#imgurltext"+ret.symptoms[i].id+"").hide();
              		}else{
          		         $("#imgurl"+ret.symptoms[i].id+"").val(imgu);
          		         $("#imgurl"+ret.symptoms[i].id+"").attr({readonly:'true'});
              		}
              		$("#confirmsym"+ret.symptoms[i].id+"").hide();
              		$("#cancelsym"+ret.symptoms[i].id+"").hide();
              		$("#file"+ret.symptoms[i].id+"").hide();
              		$("#upload"+ret.symptoms[i].id+"").hide();
              		
              }
           }
       });
	});
	
	function ageFormatter(row){
		var length = row.ages.length;
		if(length==0){
			return '';
		}
		if(length==7){
			return '全年龄段';
		}
		var ages = '';
		for(var i=0;i<length;i++){
			var s = row.ages[i].ageOption;
			var ss;
			if(s==1){
				ss = '0-30天';
			}else if(s==2){
				ss = '31天-3岁';
			}else if(s==3){
				ss = '4-8岁';
			}else if(s==4){
				ss = '9-14岁';
			}else if(s==5){
				ss = '15-35岁';
			}else if(s==6){
				ss = '36-64岁';
			}else if(s==7){
				ss = '65岁以上';
			}
			ages =ages + ',' + ss  ;
		}
		var t = ages.substring(1,ages.length)
		return t;
	}
</script>
</html>
